//
//  RectButton.m
//  Weibo
//
//  Created by taoshanchang on 15/2/2.
//  Copyright (c) 2015年 taoshanchang. All rights reserved.
//

#import "RectButton.h"

@implementation RectButton

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if(self){
        
    }
    return self;
}

-(void)setTitle:(NSString *)title{
    if(_title != title){
        _title = title;
    }

    [self setTitle:nil forState:UIControlStateNormal];
    
    if(_rectTitleLabel == nil){
        _rectTitleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _rectTitleLabel.backgroundColor = [UIColor clearColor];
        _rectTitleLabel.font = [UIFont systemFontOfSize:18.0f];
        _rectTitleLabel.textColor = [UIColor blackColor];
        _rectTitleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_rectTitleLabel];
    
    }
}
-(void)setSubTitle:(NSString *)subTitle{
    if(_subTitle != subTitle){
        _subTitle = subTitle;
    }
    
    [self setTitle:nil forState:UIControlStateNormal];
    
    if(_subTitleLabel == nil){
        _subTitleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _subTitleLabel.backgroundColor = [UIColor clearColor];
        _subTitleLabel.font = [UIFont systemFontOfSize:18.0f];
        _subTitleLabel.textColor = [UIColor blackColor];
        _subTitleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_subTitleLabel];
        
    }
}

@end
